import logging

import pytest

from resource.pom.settings import Settings


class Test:
    app = Settings

    @pytest.mark.parametrize('setup_teardown', [app.bundle_name], indirect=True)
    def test(self, setup_teardown, device):
        logging.info('步骤1.点击设置应用')
        device.start_ability(self.app.bundle_name, self.app.ability_name)
        logging.info('预期结果1.进入设置应用')
        device.assert_current_window(self.app.window_name)

        logging.info('步骤2.点击应用')
        device.click(*self.app.apps_item)
        logging.info('预期结果2.进入应用')
        device.refresh_layout()
        device.assert_text_exist('应用管理')

        logging.info('步骤3.点击应用管理')
        device.click_element(device.get_element_by_text('应用管理'))
        logging.info('预期结果3.进入应用管理')
        device.refresh_layout()
        device.assert_text_exist('kikaInput')
        # 版本后面有个空格
        device.assert_text_exist('版本 ')
